﻿// ReSharper disable InconsistentNaming

using ImageProcessing.Common;
using ImageProcessing.Detectors;
using NUnit.Framework;

namespace ImageProcessing.Tests.Detectors
{
    [TestFixture]
    public class FastDetectorTests
    {
        IInterestPointDetector FastDetector;

        private int GetImagePoints(string imageName)
        {

            int width;
            int height;

            HelperMethods.GetImageDimensions(imageName, out width, out height);


            FastDetector = new FastDetector(width, height) { Threshold = 20, Suppress = true };

            return HelperMethods.GetPoints(imageName, FastDetector).Count;
        }

        [Test]
        public void GetInterestPoints_Usb_Equal()
        {
            Assert.AreEqual(161, GetImagePoints("TestPics\\usb1.jpg"));
        }

        [Test]
        public void GetInterestPoints_Square_Equal()
        {
            Assert.AreEqual(6, GetImagePoints("TestPics\\Square.jpg"));
        }

        [Test]
        public void GetInterestPoints_Card1_Equal()
        {
            Assert.AreEqual(8, GetImagePoints("TestPics\\Card1Template.jpg"));
            Assert.AreEqual(5, GetImagePoints("TestPics\\Card1ZoomedIn.jpg"));
            Assert.AreEqual(104, GetImagePoints("TestPics\\Card1ZoomedOut.jpg"));
        }

        [Test]
        public void GetInterestPoints_Card2_Equal()
        {
            Assert.AreEqual(21, GetImagePoints("TestPics\\Card2Template.jpg"));
            Assert.AreEqual(40, GetImagePoints("TestPics\\Card2ZoomedIn.jpg"));
            Assert.AreEqual(141, GetImagePoints("TestPics\\Card2ZoomedOut.jpg"));
        }

    }
}
